Expression with Parentheses

Parentheses clarify the order of expressions, for example the eval command first evaluates the parts of expression contained within the parentheses.

Example:

| process eval("Profit_percent=(Selling_price-cost_price)/cost_price * 100")
| fields Selling_price, cost_price, Profit_percent
_images/parentheses.png

Using expression with parentheses

Here, the query calculates the specified arithmetic expression and returns its value in the Profit_percent identifier. While performing the calculation, the function first evaluates the part of the expression within the parentheses, (Selling_price-cost_price), then it uses this result in the rest of the expression.

The fields command displays the value of Selling_price, cost_price and Profit_percent in a tabular form.


Helpful?

We are glad this guide helped.


Please don't include any personal information in your comment

Contact Support